#pragma once

class Element {
private:
	std::string value;

protected:
	std::list<Element *> children;

public:
	typedef std::list<Element *>::iterator child_it;

	Element();
	virtual ~Element();

	void attachChild(Element *child);
	virtual void serialize(std::ostream &of);

	void setValue(const std::string &value) { this->value = value; }
	const std::string &getValue() const { return value; }

	int getChildCount() { return children.size(); }

	child_it child_begin() { return children.begin(); }
	child_it child_end() { return children.end(); }
};